import { BASE_URI } from "@/utils/const";
import request from '@/utils/request.js'
const USER_BASE_URL = '/user';
export default {
    getUserList(queryUserDto){
        return request({
            url: BASE_URI + USER_BASE_URL + '/list',
            data:{
                "page_no":queryUserDto.pageNo,
                "page_size":queryUserDto.pageSize,
                "user_account":queryUserDto.userAccount,
                "user_name":queryUserDto.userName,
                "user_phone":queryUserDto.userPhone
            },
            method: 'post'
        })
    },
    updateUser(userDto){
        return request({
            url: BASE_URI + USER_BASE_URL + '/update',
            data:{
                "user_account":userDto.userAccount,
                "user_name":userDto.userName,
                "user_age":userDto.userAge,
                "user_sex":userDto.currUserSex,
                "user_role":userDto.currUserRole,
                "user_phone":userDto.userPhone,
                "id":userDto.id
            },
            method: 'post'
        })
    },
    saveUser(userDto){
        return request({
            url: BASE_URI + USER_BASE_URL + '/save',
            data:{
                "user_account":userDto.userAccount,
                "user_name":userDto.userName,
                "user_age":userDto.userAge,
                "user_sex":userDto.currUserSex,
                "user_role":userDto.currUserRole,
                "user_phone":userDto.userPhone,
            },
            method: 'post'
        })
    },
    removeUser(id){
        return request({
            url: BASE_URI + USER_BASE_URL + '/remove',
            params:{"id":id},
            method: 'post'
        })
    },
    getLoginUser(loginUserDto){
        return request({
            url: BASE_URI + USER_BASE_URL + '/getUserInfo',
            params:{"userName":loginUserDto.userName, "userPwd":loginUserDto.userPwd},
            method: 'get'
        })
    },
    getUserDetail(userDto){
        return request({
            url: BASE_URI + USER_BASE_URL + '/userDetail',
            params:{"id":userDto.userId},
            method: 'get'
        })
    }
}